<extend name="Index/index" />
<block name="nav"></block>
<block name="nav1">
<link rel="stylesheet" href="__PUBLIC__/mycss/libin.css" />
    <div class="page-content">
        <div class="page-header">
            <h1>
                评论管理
                <small>
                    <i class="icon-double-angle-right"></i>
                     查看
                </small>
            </h1>
        </div><!-- /.page-header -->
    </div>
</block>

<block name="admin">

<div class="  container  ">


<div class="container">
  <div class="row clearfix">
    <div class="col-md-12 column">
      <table class="table  table-bordered ">
        <the >
          <tr  class="blue">
            <th> ID</th>
            <th> 文章标题</th>
            <th> 评论内容</th>
            <th> 评论时间</th>
            <th> 评论者</th>
            <th> 评论回复</th>
            <th> 评论状态</th>
            <th> 是否删除</th>

          </tr>
        </the>
        <tbody>
       
        <volist  name="comment" id="vo">

        <tr class="success">
            <td> <{$vo['id']}></td>
            <td> <{$vo['title']}></td>
            <td><{$vo['c_content']}></td>
            <td> <{:date("Y-m-d H:m:s",$vo['com_time'])}></td>
            <td> <{$vo['name']}></td>
            <td> <{$vo['title']}></td>
            <td >
            <button class="btn btn-info " onclick="abc(<{$vo['id']}>,this)">
            <{$vo['status']==0?'启用':'屏蔽'}></button>     
            </td>
           <td> 
           <button class="btn btn-info" onclick="del(<{$vo['id']}>, this)">删除</button></td>
        </tr>
        </volist>
        </tbody>
      </table>
    </div>
  </div>
</div>

<script>
     
function abc(id,obj){
            var pbt  =  $(obj).text();
            console.log(pbt);
            $.ajax({
                type:'get',
                url:'<{:U('Comment/status')}>',
                data:'id='+id,

                //请求成功,执行的函数
                success:function(data){
                  if ( pbt== '启用') {
                        $(obj).html('屏蔽');
                  } else{
                         $(obj).html('启用');
                  };
                }
    })
}
//删除ajax
function del(id,obj1){   
console.log($(obj1).parent().parent())

    $.ajax({
        type:'get',
        url:'<{:U('Comment/del')}>',
        data:'id='+id,
        // console.log(id),
        //请求成功 ,执行的函数
        success:function(data){
           
            $(obj1).parent().parent().remove();
        }
    })
}
</script>
</block>